import { network } from '@/utils';
import { TableListParams, InitInfoParams } from './data';

import { partner } from '../../../../../config/Apis';

export async function queryBookedRecordsList(params: TableListParams) {
  params._content_type = 'json';
  return network.get(partner.income_detail_index, {
    params,
  });
}

export async function queryPartnersList(params: InitInfoParams) {
  params._content_type = 'json';
  return network.get(partner.franchisee_list, {
    params,
  });
}

export async function queryGardenList(params: InitInfoParams) {
  return network.get(partner.common_area_garden_search, {
    params,
  });
}

export async function queryExportInfo(params: any) {
  return network.get(partner.income_detail_index, { params });
  // const paramsArr = Object.entries(params);
  // let paramsURL = '';
  // paramsArr.reduce((origin: any, target: any, index: number) => {
  //   paramsURL += index >= (paramsArr.length - 1)
  //     ? `${target[0]}=${target[1]}`
  //     : `${target[0]}=${target[1]}&`;
  //   return null;
  // }, 0);
  // window.location.href = `${partner.income_detail_index}?${paramsURL}`;
}
